package com.mhkjup.artcircle.aop;

import org.apache.log4j.Logger;
import org.aspectj.lang.ProceedingJoinPoint;

import com.mhkjup.artcircle.model.ResponseMessage;

public class LoggerAdvice{
	
	private static Logger logger = null;
	String strLog = null;
    //设置访问路径
	public Object doAround(ProceedingJoinPoint pjp) throws Throwable {
		try {
			Object retVal = pjp.proceed();
			return retVal;
		} catch (Exception e) {
			// TODO: handle exception
			logger = Logger.getLogger(pjp.getTarget().getClass().getName()+"."+pjp.getSignature().getName());
			logger.error("["+e.getMessage()+"]\n"+e.getStackTrace()[0]);
		}
		return new ResponseMessage(500,"网络错误",null);
	}
	
}
